import { getRequest, postRequest } from '@/utils/http'
import type { Result } from '@/types/result'
import type { PageResult } from '@/types/page-result'
import type { AncientTreePageQueryDTO, TreeDTO } from '@/types/request'
import type { AncientTree } from '@/types/response'

export const getTreeInfo = (): Promise<Result> => {
  return getRequest('/common/page')
}

//分页查询古树信息
export const getTreeInfoPage = (
  params: AncientTreePageQueryDTO,
): Promise<Result<PageResult<AncientTree>>> => {
  return postRequest('/common/page', params)
}

//上传图片
export const upload = (params: TreeDTO): Promise<Result> => {
  return postRequest('/common/upload', params)
}
